package Dame;

import java.io.File;
import java.util.HashMap;

public class test3 {
    public static void main(String[] args) {
        File f1 = new File("G:\\javaSE_plus\\day11");
        HashMap<String, Integer> hm = new HashMap<>();
        getCount(hm, f1);
        System.out.println(hm);
    }

    private static void getCount(HashMap<String, Integer> hm, File f1) {
        File[] f = f1.listFiles();
        for (File file : f) {
            String name = file.getName();
            String[] split = name.split("\\.");
            if (split.length == 2) {
                String s = split[1];
                if (hm.containsKey(s)) {
                    Integer count = hm.get(s);
                    count++;
                    hm.put(s, count);
                } else {
                    hm.put(s,1);
                }
            } else {
                getCount(hm, file);
            }
        }
    }
}
